class collition_child extends eui.Component implements  eui.UIComponent {
	collitiontype:eui.Image
	collitionname:eui.Label
	collitionONOFF:eui.Label
	parent1:CSPRITE
	group:eui.Group
	public constructor() {
		super();
	}

	protected partAdded(partName:string,instance:any):void
	{
		super.partAdded(partName,instance);
	}


	protected childrenCreated():void
	{
		super.childrenCreated();
		this.group.touchEnabled=true
		this.group.touchChildren=false;
		this.collitionname.name="name"
		//this.addEventListener(egret.TouchEvent.TOUCH_BEGIN,()=>{this.currentState="down";},this)
		//this.addEventListener(egret.TouchEvent.TOUCH_END,()=>{this.currentState="up";},this)
		this.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onclick,this)
	}
	public setup(onoff:string,name:string,type:string)
	{
		
		this.collitionONOFF.text=onoff
		this.collitionname.text=name
		this.collitiontype.source=type
        this.group.name=name
	}

	public setparent(a:CSPRITE)
	{
		this.parent1=a;
	}
	public onclick()
	{
	    CMainEditor.editor.objectchangetocollition();
		CMainEditor.editor.rightchangeTOcollition();
		for(let a=0;a<this.parent1.judge.length;a++)
		{
			
			if(this.parent1.judge[a].name==this.collitionname.text)
			{
			
				CCollitionEditor.editor.goal=this.parent1.judge[a]
				CMainEditor.editor.goal=CBASE_MANAGE.getCBASE_MANAGE.getanyoneByname(this.parent1.objName)
				return;
			}
		}
		for(let a=0;a<this.parent1.unjudge.length;a++)
		{
			if(this.parent1.unjudge[a].name==this.collitionname.text)
			{
				CCollitionEditor.editor.goal=this.parent1.unjudge[a]
			    CMainEditor.editor.goal=CBASE_MANAGE.getCBASE_MANAGE.getanyoneByname(this.parent1.objName)
				return
			}
		}
		
	}
}